﻿using System.Collections.Generic;
using System.Text.RegularExpressions;

namespace BodaNetCommunications.Utilities.DataLibs
{
    public class BoolLib
    {
        public static bool[] GetBoolArray(string val)
        {
            List<bool> Result = new List<bool>();
            if (val.Contains(' '))
            {
                string[] str = Regex.Split(val, "\\s+", RegexOptions.IgnoreCase);

                foreach (var item in str)
                {
                    Result.Add(item.ToLower() == "true" || item.ToLower() == "1");
                }
            }
            else
            {
                Result.Add(val.ToLower() == "true" || val.ToLower() == "1");
            }

            return Result.ToArray();
        }
    }
}